//------------------------------------------------------------------------
//
//	CCGameBox is a game development library for iPhone and iPod Touch.
//
//	Licensed under the BSD license, see LICENSE in root for details.
// 
//	Copyright (c) 2009 James Hui (a.k.a. Dr.Watson)
// 
//	For latest updates, please visit http://www.cocoachina.com
//
//------------------------------------------------------------------------

#ifndef _CCTYPES_H
#define _CCTYPES_H

#ifdef WIN32
	#include <GLES/gl.h>
#else
	#import <OpenGLES/ES1/gl.h>
	#import <OpenGLES/ES1/glext.h>
#endif


#ifndef M_PI
#define M_PI		(3.1415927f)
#define M_PI_2		(1.5707963f)			// 90 degree
#define M_PI_4		(0.7853982f)			// 45 degree
#define M_PI_6		(0.5233333f)			// 30 degree
#define M_PI_12		(0.2616667f)			// 15 degree
#define M_1_PI		(0.3183099f)
#define M_2_PI		(0.6366198f)
#endif

#define RAD2DEG		57.29577951f
#define DEG2RAD		0.017453293f

#define SAFE_DELETE(x)			if (x) { delete x; x = NULL; }
#define SAFE_DELETE_ARRAY(x)	if (x) { delete [] x; x = NULL; }

typedef float			f32;
typedef double			f64;

typedef unsigned char	u8;
typedef unsigned short	u16;
typedef unsigned int	u32;
typedef unsigned long	u64;

typedef signed char		s8;
typedef signed short	s16;
typedef signed int		s32;
typedef signed long		s64;

#define ARGB(a, r, g, b)		((a << 24) | (r << 16) | (g << 8) | b)
#define RGBA(r, g, b, a)		((a << 24) | (b << 16) | (g << 8) | r)

#ifndef NULL
#define NULL			0
#endif


struct CCColor
{
	u8 r;
	u8 b;
	u8 g;
	u8 a;
};


struct CCColorf
{
	float r;
	float b;
	float g;
	float a;
};


struct Vertex2D
{
	float x, y;
};

struct CCPoint {
	float x;
	float y;
};

struct CCRect {
	float x;
	float y;
	float width;
	float height;
};

#endif
